﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="false" 
CodeFile="rptBillinglist.aspx.cs" Inherits="SIPO.Web.lists.Report.rptBillinglist" %>

<asp:Content ID="ctnBody" ContentPlaceHolderID="body" runat="server">

    <link href="<%= ResolveUrl("~/styles/jquery.validate.error.css") %>" rel="stylesheet" type="text/css" />
    

    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery-ui.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
   
    
    <script type="text/javascript">
        $(document).ready(function () {
            //default radio button semua
            $("#<%= txtPeriodeAwal.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtPeriodeAkhir.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtDueDateAwal.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtDueDateAkhir.ClientID %>").attr('disabled', 'disabled');
            $("#<%= ddlJenisTagihan.ClientID %>").attr('disabled', 'disabled');
            $("#<%= ddlAksiDebitur.ClientID %>").attr('disabled', 'disabled');
            $("#<%= txtPeriodeAwal.ClientID %>").val('');
            $("#<%= txtPeriodeAkhir.ClientID %>").val('');
            $("#<%= txtDueDateAwal.ClientID %>").val('');
            $("#<%= txtDueDateAkhir.ClientID %>").val('');
            $("#<%= ddlAksiDebitur.ClientID %>").val('-- pilih aksi debitur --');
            $("#<%= ddlJenisTagihan.ClientID %>").val('-- pilih jenis transaksi --');

            // format tanggal dengan datepicker
            $("#<%= txtPeriodeAwal.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtPeriodeAkhir.ClientID %>").datepicker("option", "minDate", selected)
                }
            });

            $("#<%= txtPeriodeAkhir.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtPeriodeAwal.ClientID %>").datepicker("option", "maxDate", selected)
                }
            });



            $("#<%= txtDueDateAwal.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtDueDateAkhir.ClientID %>").datepicker("option", "minDate", selected)
                }
            });

            $("#<%= txtDueDateAkhir.ClientID  %>").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#<%= txtDueDateAwal.ClientID %>").datepicker("option", "maxDate", selected)
                }
            });


            //radio button periode awal dan periode akhir
            $("#<%= rbPeriode1.ClientID %>").click(function () {
                $("#<%= txtPeriodeAwal.ClientID %>").removeAttr('disabled');
                $("#<%= txtPeriodeAkhir.ClientID %>").removeAttr('disabled');
            });

            $("#<%= rbPeriode2.ClientID %>").click(function () {
                $("#<%= txtPeriodeAwal.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtPeriodeAkhir.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtPeriodeAwal.ClientID %>").val('');
                $("#<%= txtPeriodeAkhir.ClientID %>").val('');
            });

            //radio button due date awal dan akhir
            $("#<%= rbDueDate1.ClientID %>").click(function () {
                $("#<%= txtDueDateAwal.ClientID %>").removeAttr('disabled');
                $("#<%= txtDueDateAkhir.ClientID %>").removeAttr('disabled');
            });

            $("#<%= rbDueDate2.ClientID %>").click(function () {
                $("#<%= txtDueDateAwal.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtDueDateAkhir.ClientID %>").attr('disabled', 'disabled');
                $("#<%= txtDueDateAwal.ClientID %>").val('');
                $("#<%= txtDueDateAkhir.ClientID %>").val('');
            });

            //radio button tipe transaksi
            $("#<%= rbJenisTagihan1.ClientID %>").click(function () {
                $("#<%= ddlJenisTagihan.ClientID %>").removeAttr('disabled');
            });

            $("#<%= rbJenisTagihan2.ClientID %>").click(function () {
                $("#<%= ddlJenisTagihan.ClientID %>").attr('disabled', 'disabled');
                $("#<%= ddlJenisTagihan.ClientID %>").val('-- pilih jenis transaksi --');
            });

            //radio button aksi debitur
            $("#<%= rbAksiDebitur1.ClientID %>").click(function () {
                $("#<%= ddlAksiDebitur.ClientID %>").removeAttr('disabled');
            });

            $("#<%= rbAksiDebitur2.ClientID %>").click(function () {
                $("#<%= ddlAksiDebitur.ClientID %>").attr('disabled', 'disabled');
                $("#<%= ddlAksiDebitur.ClientID %>").val('-- pilih aksi debitur --');
            });

            $("#btnNext").click(function () {
                var periodeAwal = $("#<%= txtPeriodeAwal.ClientID %>").val();
                var periodeAkhir = $("#<%= txtPeriodeAkhir.ClientID %>").val();
                var dueDateAwal = $("#<%= txtDueDateAwal.ClientID %>").val();
                var dueDateAkhir = $("#<%= txtDueDateAkhir.ClientID %>").val();
                var transactionTypeID = $("#<%= ddlJenisTagihan.ClientID %>").val();
                var debtorSectorID = $("#<%= ddlAksiDebitur.ClientID %>").val();
                var balance;


                if ($("#<%= rbBalance1.ClientID %>").is(":checked")) {
                    balance = $("#<%= rbBalance1.ClientID %>").val();
                } else if ($("#<%= rbBalance2.ClientID %>").is(":checked")) {
                    balance = $("#<%= rbBalance2.ClientID %>").val();
                } else {
                    balance = $("#<%= rbBalance3.ClientID %>").val();
                }

                window.location = "rptBillinglist.aspx?periodeAwal=" + periodeAwal + "&periodeAkhir=" + periodeAkhir + "&dueDateAwal=" + dueDateAwal + "&dueDateAkhir=" + dueDateAkhir + "&transTypeID=" + transactionTypeID + "&debtorSectorID=" + debtorSectorID + "&balance=" + balance;
            });

        });
    </script>

            <table border="0">
                <tr>
                    <td style="width: 50">
                        Periode
                    </td>
                    <td>
                        :
                    </td>
                    <td>
                        <asp:RadioButton ID="rbPeriode1" runat="server" GroupName="rbPeriode" /><asp:TextBox ID="txtPeriodeAwal" runat="server" Width="150"></asp:TextBox> s/d
                        <asp:TextBox ID="txtPeriodeAkhir" runat="server" Width="150" value=""></asp:TextBox>
                    </td>
                </tr>
                <tr>
                <td colspan="2"></td>
                <td>
                        <asp:RadioButton ID="rbPeriode2" runat="server" GroupName="rbPeriode" 
                            Checked="True" Text="Semua" />
                    </td>
               </tr>
                <tr>
                <td style="width: 50">
                        Due Date
                    </td>
                    <td>
                        :
                    </td>
                    <td>
                        <asp:RadioButton ID="rbDueDate1" runat="server" GroupName="rbDueDate" /><asp:TextBox ID="txtDueDateAwal" runat="server" Width="150"></asp:TextBox> s/d
                        <asp:TextBox ID="txtDueDateAkhir" runat="server" Width="150"></asp:TextBox>
                    </td>
                 </tr>
                 <tr>
                 <td colspan="2"></td>
                 <td>
                        <asp:RadioButton ID="rbDueDate2" runat="server" GroupName="rbDueDate" 
                            Checked="True" Text="Semua" />
                   </td>
                </tr>
                <tr>
                    <td style="width: 50">
                        Jenis Tagihan
                    </td>
                    <td>
                        :
                    </td>
                    <td>
                        <asp:RadioButton ID="rbJenisTagihan1" runat="server" GroupName="rbJenisTagihan"/>
                        <asp:DropDownList ID="ddlJenisTagihan" runat="server" Width="200">
                        </asp:DropDownList>
                    </td>
                 </tr>
                 <tr>
                    <td colspan="2"></td>
                    <td>
                        <asp:RadioButton ID="rbJenisTagihan2" runat="server" GroupName="rbJenisTagihan" 
                            Checked="True" Text="Semua" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 50">
                        Debitur
                    </td>
                    <td>
                        :
                    </td>
                    <td>
                        <asp:RadioButton ID="rbAksiDebitur1" runat="server" GroupName="rbAksiDebitur"/>
                        <asp:DropDownList ID="ddlAksiDebitur" runat="server" Width="450">
                        </asp:DropDownList>
                    </td>
                 </tr>
                 <tr>
                 <td colspan="2"></td>
                 <td>
                        <asp:RadioButton ID="rbAksiDebitur2" runat="server" GroupName="rbAksiDebitur" 
                            Checked="True" Text="Semua" />
                    </td>
                </tr>
                <tr>
                    <td style="width: 50">
                    Balance
                    </td>
                    <td>
                        :
                    </td>
                    <td>
                        <asp:RadioButton ID="rbBalance1" value="1" text="Belum Lunas" runat="server" GroupName="rbBalance"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                        <td><asp:RadioButton ID="rbBalance2" value="2" text="Lunas" runat="server" GroupName="rbBalance"/></td>
                </tr>
                <tr>
                    <td colspan="2"></td>
                        <td><asp:RadioButton ID="rbBalance3" value="3" text="Semua" runat="server" GroupName="rbBalance" Checked="true"/></td>
                </tr>
                <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnNext" type="button">Lanjut</button>
                    <button class="dialog_link ui-state-default ui-corner-all" id="btnCancel" type="button">Batal</button>
                </div>
            </td>
        </tr>
      </table>
      <div>
        <asp:ScriptManager ID="scManager" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <rsweb:ReportViewer  ID="rsViewer" runat="server" Height="100%" Width="100%">
        </rsweb:ReportViewer>
    </div>
</asp:Content>
